home *** CD-ROM | disk | FTP | other *** search
/ Macademic for Students & Teachers / Macademic for Students and Teachers (Quantum Leap)(1992).iso / Fun & Games / CoreWar / Downtown Super < prev    next >
Encoding:
Text File  |  1985-10-01  |  5.3 KB  |  178 lines  |  [FGHT/CWAR]

  1. *
  2. * Downtown Jack
  3. * Courtesy of Bob Schumaker [72227,2103]
  4. *
  5. * a multi-process program that so far handles everything that
  6. * I have thrown against it.  It stop worms, survives dwarves,
  7. * stakes vampires (or else lets them kill themselves), laughs
  8. * at imps, tromps geminis, and eats cannons of both flavors
  9. * for breakfast.  Admittedly this has not been exhaustively
  10. * tested for all kinds of enemy programs, but it is guaranteed
  11. * to win against:
  12. *
  13. * the standard '5' dwarf -- from any starting address
  14. * a worm -- although it can sometimes take a looooong time
  15. * an imp
  16. *
  17. * If anyone improves on this program or comes up with a
  18. * program that it can't handle (not too difficult, really)
  19. * I'd love to see it!
  20. *
  21. * thanks go out to Kurt Jaeger (KJ) for the blindingly (!)
  22. * fast copy routine that made this monstrosity possible!
  23. *
  24. @-1044                                * start is +56
  25. target      dat 0
  26. @-2
  27. impwall     dat 0
  28. math        dat 0
  29. @0
  30. firstin     pct impwall              * for fast imps
  31.             mov dwarf1,saved1
  32.             mov dwarf2,saved2
  33.             mov dwarf3,saved3
  34.             mov bomber,saveb
  35.             mov #(target-start),begin
  36.             mov begin,dst
  37.             add #(ending-start),dst
  38.             add #(start-dst),dst     * don't forget relativity
  39.             mov dst,dstval           * build fences to detect
  40.             mov begin,fence1         * enemy activity
  41.             add #140,fence1
  42.             mov fence1,fence2
  43.             sub #2,fence2
  44.             mov fence2,fence3
  45.             sub #2,fence3
  46.             mov fence3,fence4
  47.             sub #2,fence4
  48.             mov fence4,fencep
  49.             sub #2,fencep            * for imps later
  50.             sub #(fence2-fence1),fence2
  51.             sub #(fence3-fence1),fence3
  52.             sub #(fence4-fence1),fence4
  53.             sub #(fencep-fence1),fencep
  54.             sub #(begin-start),begin
  55.             mov #0,killpt
  56.             sub begin,killpt
  57.             sub #(killpt-junk),killpt
  58.             jmp start0               * start the ballgame
  59. @53
  60. src         dat 0
  61. dst         dat 0
  62. loopcnt     dat 0
  63. @56
  64. start       mov #1200,loopcnt        * try for a kill here
  65.             mov #144,bombpt          * a multiple of 8
  66.             mov dstval,dst
  67. loop        mov #0,@killpt
  68.             djz start0,loopcnt
  69.             jmp loop
  70. begin       dat 0
  71. drunk       dat 0
  72. @64
  73. start0      mov saved1,dwarf1       * restore the bombers
  74.             mov saved2,dwarf2
  75.             mov saved3,dwarf3
  76.             mov saveb,bomber
  77.             spl bomber
  78.             spl dwarves
  79.             jmp fencer
  80. drunk       dat 0                    * gets bombed
  81. @72
  82. fence3      dat 0
  83. cleanup     pct src                  * stop imps and go to new
  84.             mov #0,dwarf1            * home (kill the dwarves)
  85.             mov #0,dwarf2
  86.             mov #0,dwarf3
  87.             jmp @begin
  88. fence4      dat 0
  89. drunk       dat 0
  90. @80
  91. watcher     cmp #66,@fence1        * wait for someone to step
  92.             jmp watch2             * on the fences
  93.             jmp hfence1
  94. watch2      cmp #66,@fence2
  95.             jmp watch3
  96.             jmp hfence2
  97. fence1      dat 0
  98. @88
  99. watch3      cmp #66,@fence3
  100.             jmp watch4
  101.             jmp hfence3
  102. watch4      cmp #66,@fence4
  103.             jmp watcher
  104.             jmp hfence4
  105. fence2      dat 0
  106. @95
  107. bombpt      dat 144                 * a multiple of 8
  108. @96
  109. bomber      add #24,bombpt          * zip through memory in
  110.             mov #0,@bombpt          * the hopes of hitting
  111.             jmp bomber              * someone (ha!)
  112. saveb       dat 0
  113. saved1      dat 0
  114. saved2      dat 0
  115. saved3      dat 0
  116. @104
  117. runaway     mov #0,bomber           * we've seen someone!
  118.             mov #0,@fencep          * unprotect this spot
  119.             mov #(ending-src),src   * move stuff real fast
  120. jumplp      mov @src,@dst           * nice short routine
  121.             djz cleanup,src         * compliments of KJ
  122.             sub #1,dst
  123.             jmp jumplp
  124. @112
  125. fencer      mov #66,@fence1         * set up the fences
  126.             mov #66,@fence2
  127.             mov #66,@fence3
  128.             mov #66,@fence4
  129.             mov #66,@fencep
  130.             pct @fencep
  131.             jmp watcher             * and watch them
  132. @120
  133. hfence1     spl k1                  * hit fence 1
  134.             spl k2                  * kill dwarves that a
  135.             jmp runaway             * five dwarf would anyway
  136. hfence2     spl k3
  137.             spl k2
  138.             jmp runaway
  139. k1          mov #0,dwarf1           * kill the dwarf --
  140. drunk       dat 0                   * and die
  141. @128
  142. hfence3     spl k1                  * same idea, other dwarfs
  143.             spl k2
  144.             jmp runaway
  145. hfence4     spl k2
  146.             spl k3
  147.             jmp runaway
  148. k2          mov #0,dwarf2
  149. @136
  150. dwarf1      add #3,bomb1   * these dwarves are situated so
  151.             mov #0,@bomb1  * that a '5' dwarf in any position
  152.             jmp dwarf1     * will not kill all three of them.
  153. dwarf2      add #3,bomb2   * kill includes hitting the bombpt
  154.             mov #0,@bomb2
  155.             jmp dwarf2
  156. k3          mov #0,dwarf3
  157. @144
  158. fence9      dat 0
  159. fencet      dat 0
  160. dstval      dat 0
  161. killpt      dat 0
  162. dwarf3      add #3,bomb3
  163.             mov #0,@bomb3
  164.             jmp dwarf3
  165. @152
  166. fencep      dat 0
  167. dwarves     mov #20,bomb1     * start off all the dwarves
  168.             mov #20,bomb2
  169.             mov #20,bomb3
  170.             spl dwarf1
  171.             spl dwarf2
  172.             jmp dwarf3
  173. ending      dat 0
  174. @160
  175. bomb3       dat 20
  176. bomb2       dat 20
  177. bomb1       dat 20
  178.